<template>
    <el-table :data="data" stripe class="w-full" :default-sort="{ prop: 'PV', order: 'descending' }" :fit="true">
        <el-table-column type="index" label="序号" width="100" align="center" />
        <el-table-column prop="name" label="时间" align="center">
            <template #default="scope">
                {{ formatDate(scope.row.name) }}
            </template>
        </el-table-column>
        <el-table-column prop="PV" label="PV" sortable align="center" />
        <el-table-column prop="UV" label="UV" sortable align="center" />
        <el-table-column prop="IP" label="IP" sortable align="center" />
    </el-table>
</template>

<script setup lang="ts">
import { IRegion } from '@/api/sem/types'
import { dateFormat } from '@/utils/date'

defineProps<{
    data: IRegion[]
}>()

const formatDate = computed(() => {
    return function (data: string) {
        return dateFormat(data, 'YYYY-MM-DD')
    }
})
</script>

<style scoped></style>